<?php

abstract class MsssqlDB
{
	private $server;
	private $user;
	private $pass;
	private $table;
	private $numrow;
	private $field;
	private $pointsql;

	protected function __construct($server,$user,$pass,$table)
	{

		$this->server = $server;
		$this->user = $user;
		$this->pass = $pass;
		$this->table = $table;
		
		$this->contodb();
	} 


	private function contodb()
	{
	    mssql_connect($this->server,$this->user,$this->pass) or die("Error Connect to Database.");
  	    mssql_select_db($this->table) or die("Error Not Select.");
		//echo $this->server;
		//echo $this->table;
		
	}


	 protected function msssqlselectdata($data,$table,$condition)
	{

		$sql = '';
			if($condition != "")
			{
				$sql = "SELECT"." ".$data." "."FROM"." ".$table." "."WHERE"." ".$condition ;
			}else{
				$sql = "SELECT"." ".$data." "."FROM"." ".$table ;
			}	
		//	echo $sql;
			// $this->mssqlclose();
		return $this->mssqlquery($sql);
	}

	protected  function MssqlInsert($table,$data,$input)
	{
				$this->field = $field;
				$this->table = $table;
				$this->pointsql = $pointsql;
			 
			 	$this->sql = "INSERT INTO"." "."$this->table"." ". 
							 "("."$this->field".")".
							 " "."VALUES"." "."("."$this->pointsql".")";
			 	 if(mssql_errno() > 0)  die (mssql_error());
				 
				//echo $this->sql;
				
			 	 
		
		
		return $this->mssqlquery($sql);;
	}
	

	protected  function MssqlUpdate()
	{
		return ;
	}

	protected  function MssqlDelete()
	{
		return ;
	}

	protected function mssqlquery($query)
	{

		return @mssql_query($query);
	}
	
	protected function mssqlclose()
	{
		@mssql_close();
	}
	
	protected function msssqlfetchrow($result)
	{
		return @mssql_fetch_row($result);
	}

	protected function msssqlnumrows($query)
	{
		return @mssql_num_rows($query);
	}
	
	 protected function mssqlfetcharray($result)
	{
		return @mssql_fetch_array($result);
	}
	
	
	protected function mssqlinit()
	{
		return mssql_init($sp_name);
	}

	protected function mssqlbind($stmt, $param_name, $var, $type)
	{

		return mssql_bind($stmt, $param_name, $var, $type);
	}

	 protected function mssqlexecute($stmt)
	{
		return mssql_execute($stmt);
	}

}



?>